<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<script src="./vue.min.js"></script>
<style>
    * {
        margin: 0;
        padding: 0;
    }
    [v-cloak]{
        display: none;
    }
    #app {
        width: 100%;
        box-sizing: border-box;
        background: #fff;
        overflow: hidden;
    }
    .top {
       -webkit-app-region: drag;
        width: 100%;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 1px #ddd dashed;
        padding: 0 10px;
        box-sizing: border-box;
    }
    .top .img {
        width: 34px;
        height: 34px;
        border-radius: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: #314659;
    }
    .top .img img {
        width: 26px;
        height: 26px;
    }
    .top .text {
        color: #999;
        font-size: 14px;
    }
    .top .show-menu {
      width: 26px;
      height: 26px;
      cursor: pointer;
    }
    .translate {
        width: 100%;
        background: #F7F7F9;
        font-size: 12px;
        color: #555;
        box-sizing: border-box;
        padding: 5px;
    }
    .trans-item {
        line-height: 20px;
    }
    .options-item {
        border-bottom: 1px #ddd dashed;
        height: 35px;
        line-height: 35px;
        padding: 0 10px;
        color: #333;
        font-size: 14px;
        cursor: pointer;
    }
    .options-item:last-child {
        border-bottom: none !important;
    }
    .icon {
        width: 20px;
        height: 20px;
        margin-right: 5px;
    }
    .select-item {
        display: flex;
        align-items: center;
    }

    .menu-container {
      display: flex;
      flex-wrap: wrap;
      justify-content: flex-start;
      align-items: center;
    }
    .menu-container .select-item {
      width: 80px;
      height: 80px;
      padding: 15px 0;
      box-sizing: border-box;
      display: flex;
      flex-direction: column;
      align-items: center;
    }

    .menu-container .icon {
      width: 30px;
      height: 30px;
    }
    
    .menu-container .plugin-name {
      margin-top: 4px;
      font-size: 12px;
    }

    .spinner {
        padding-left: 10px;
    }

    .spinner > div {
        width: 10px;
        height: 10px;
        background-color: #ddd;

        border-radius: 100%;
        display: inline-block;
        -webkit-animation: bouncedelay 1.4s infinite ease-in-out;
        animation: bouncedelay 1.4s infinite ease-in-out;
        /* Prevent first frame from flickering when animation starts */
        -webkit-animation-fill-mode: both;
        animation-fill-mode: both;
    }

    .spinner .bounce1 {
        -webkit-animation-delay: -0.32s;
        animation-delay: -0.32s;
    }

    .spinner .bounce2 {
        -webkit-animation-delay: -0.16s;
        animation-delay: -0.16s;
    }
    @-webkit-keyframes bouncedelay {
        0%, 80%, 100% { -webkit-transform: scale(0.0) }
        40% { -webkit-transform: scale(1.0) }
    }

    @keyframes bouncedelay {
        0%, 80%, 100% {
            transform: scale(0.0);
            -webkit-transform: scale(0.0);
        } 40% {
              transform: scale(1.0);
              -webkit-transform: scale(1.0);
          }
    }
</style>
<script src="./index.js" type="module"></script>
<body>
<div id="app" v-cloak>
  <div class="top">
    <span class="img" @click="openMainWindow"><img src="./assets/logo.png" /></span>
    <span class="text" v-if="selectData.text && selectData.text.length && !showMenu">
      选择的文本 {{selectData.text.length}} 个
    </span>
    <img v-if="!showMenu" @click="changeMenu" class="show-menu" src="./assets/app-menu.png" />
  </div>
  <div class="spinner" v-if="loading">
    <div class="bounce1"></div>
    <div class="bounce2"></div>
    <div class="bounce3"></div>
  </div>
  <div class="translate" v-if="selectData.translate && !loading && !showMenu">
    <div>{{selectData.translate.src}}</div>
    <div v-if="selectData.translate.basic">
      <div v-for="item in selectData.translate.basic.explains">
        {{item}}
      </div>
    </div>
    <div v-else>
      <div v-for="item in selectData.translate.translation">
        {{item}}
      </div>
    </div>
  </div>
  <div :class="showMenu && 'menu-container'">
    <div :style="{background: op.color}" @click="() => commonClick(op, selectData.fileUrl)" :class="showMenu ? 'menu-item' : 'options-item'" v-for="op in targetOptions">
      <div class="select-item">
        <img class="icon" :src="op.logo" />
        <span class="plugin-name">{{op.cmd || op.name}}</span>
      </div>
    </div>
  </div>
  
</div>
</body>
</html>

